<!DOCTYPE html>
<html lang="zh-CN">
  <head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width,initial-scale=1">
    <title>Vue安装 | Life &amp; Hobby</title>
    <meta name="generator" content="VuePress 1.6.0">
    <link rel="png" href="/icon.png">
    <meta name="description" content="">
    <meta name="theme-color" content="#3eaf7c">
    <meta name="apple-mobile-web-app-capable" content="yes">
    <meta name="apple-mobile-web-app-status-bar-style" content="black">
    <link rel="preload" href="/assets/css/0.styles.23c5269e.css" as="style"><link rel="preload" href="/assets/js/app.443cfbf6.js" as="script"><link rel="preload" href="/assets/js/3.1a8b1c56.js" as="script"><link rel="preload" href="/assets/js/1.35aae7fc.js" as="script"><link rel="preload" href="/assets/js/54.8547cd19.js" as="script"><link rel="prefetch" href="/assets/js/10.b89f2468.js"><link rel="prefetch" href="/assets/js/11.9c7cd056.js"><link rel="prefetch" href="/assets/js/12.9c0bfae8.js"><link rel="prefetch" href="/assets/js/13.bf1e5e5a.js"><link rel="prefetch" href="/assets/js/14.c484b2a0.js"><link rel="prefetch" href="/assets/js/15.8c07680a.js"><link rel="prefetch" href="/assets/js/16.23062341.js"><link rel="prefetch" href="/assets/js/17.ae61d754.js"><link rel="prefetch" href="/assets/js/18.6880cf60.js"><link rel="prefetch" href="/assets/js/19.ae0425d6.js"><link rel="prefetch" href="/assets/js/20.d1b6e796.js"><link rel="prefetch" href="/assets/js/21.cf5ea939.js"><link rel="prefetch" href="/assets/js/22.e18f8681.js"><link rel="prefetch" href="/assets/js/23.37328433.js"><link rel="prefetch" href="/assets/js/24.fba12fb6.js"><link rel="prefetch" href="/assets/js/25.57a16ad9.js"><link rel="prefetch" href="/assets/js/26.4cca75d9.js"><link rel="prefetch" href="/assets/js/27.1d2f6922.js"><link rel="prefetch" href="/assets/js/28.96218882.js"><link rel="prefetch" href="/assets/js/29.a8fb07c8.js"><link rel="prefetch" href="/assets/js/30.381b61b5.js"><link rel="prefetch" href="/assets/js/31.34dff827.js"><link rel="prefetch" href="/assets/js/32.1aa7b174.js"><link rel="prefetch" href="/assets/js/33.366f0768.js"><link rel="prefetch" href="/assets/js/34.99c01ba7.js"><link rel="prefetch" href="/assets/js/35.397d40cf.js"><link rel="prefetch" href="/assets/js/36.96d956b6.js"><link rel="prefetch" href="/assets/js/37.b4035fd8.js"><link rel="prefetch" href="/assets/js/38.fd449926.js"><link rel="prefetch" href="/assets/js/39.1286c93d.js"><link rel="prefetch" href="/assets/js/4.bbe797fb.js"><link rel="prefetch" href="/assets/js/40.165f9e26.js"><link rel="prefetch" href="/assets/js/41.5f719582.js"><link rel="prefetch" href="/assets/js/42.aff65ebb.js"><link rel="prefetch" href="/assets/js/43.6831adb0.js"><link rel="prefetch" href="/assets/js/44.4bc90034.js"><link rel="prefetch" href="/assets/js/45.9f777eb7.js"><link rel="prefetch" href="/assets/js/46.fe0cbaaa.js"><link rel="prefetch" href="/assets/js/47.a1586b31.js"><link rel="prefetch" href="/assets/js/48.c1c18fea.js"><link rel="prefetch" href="/assets/js/49.17462277.js"><link rel="prefetch" href="/assets/js/5.6f49a424.js"><link rel="prefetch" href="/assets/js/50.3c30e918.js"><link rel="prefetch" href="/assets/js/51.123fc8f8.js"><link rel="prefetch" href="/assets/js/52.2257ed73.js"><link rel="prefetch" href="/assets/js/53.625d9e7f.js"><link rel="prefetch" href="/assets/js/55.f0356ada.js"><link rel="prefetch" href="/assets/js/56.f12e898e.js"><link rel="prefetch" href="/assets/js/57.257a9d06.js"><link rel="prefetch" href="/assets/js/58.b5d5ef04.js"><link rel="prefetch" href="/assets/js/59.ac1d2e70.js"><link rel="prefetch" href="/assets/js/6.7b8c6394.js"><link rel="prefetch" href="/assets/js/60.c3bb3a41.js"><link rel="prefetch" href="/assets/js/61.a324e266.js"><link rel="prefetch" href="/assets/js/62.377390be.js"><link rel="prefetch" href="/assets/js/63.87e07808.js"><link rel="prefetch" href="/assets/js/64.a6993946.js"><link rel="prefetch" href="/assets/js/65.99e40bc6.js"><link rel="prefetch" href="/assets/js/66.6833c503.js"><link rel="prefetch" href="/assets/js/67.e13a348f.js"><link rel="prefetch" href="/assets/js/68.5ce7adeb.js"><link rel="prefetch" href="/assets/js/69.642cde0f.js"><link rel="prefetch" href="/assets/js/7.afeb76e6.js"><link rel="prefetch" href="/assets/js/70.814cf983.js"><link rel="prefetch" href="/assets/js/71.85d1770e.js"><link rel="prefetch" href="/assets/js/72.7d58fff3.js"><link rel="prefetch" href="/assets/js/73.a7a32798.js"><link rel="prefetch" href="/assets/js/8.d6924890.js"><link rel="prefetch" href="/assets/js/9.7af42793.js">
    <link rel="stylesheet" href="/assets/css/0.styles.23c5269e.css">
  </head>
  <body>
    <div id="app" data-server-rendered="true"><div class="theme-container" data-v-2d5f533b><div data-v-2d5f533b><div id="loader-wrapper" class="loading-wrapper" data-v-d48f4d20 data-v-2d5f533b data-v-2d5f533b><div class="loader-main" data-v-d48f4d20><div data-v-d48f4d20></div><div data-v-d48f4d20></div><div data-v-d48f4d20></div><div data-v-d48f4d20></div></div> <!----> <!----></div> <div class="password-shadow password-wrapper-out" style="display:none;" data-v-64685f0e data-v-2d5f533b data-v-2d5f533b><h3 class="title" style="display:none;" data-v-64685f0e data-v-64685f0e>Life &amp; Hobby</h3> <!----> <label id="box" class="inputBox" style="display:none;" data-v-64685f0e data-v-64685f0e><input type="password" value="" data-v-64685f0e> <span data-v-64685f0e>Konck! Knock!</span> <button data-v-64685f0e>OK</button></label> <div class="footer" style="display:none;" data-v-64685f0e data-v-64685f0e><span data-v-64685f0e><i class="iconfont reco-theme" data-v-64685f0e></i> <a target="blank" href="https://vuepress-theme-reco.recoluan.com" data-v-64685f0e>vuePress-theme-reco</a></span> <span data-v-64685f0e><i class="iconfont reco-copyright" data-v-64685f0e></i> <a data-v-64685f0e><span data-v-64685f0e>柚子</span>
            
          <span data-v-64685f0e>2018 - </span>
          2021
        </a></span></div></div> <div class="hide" data-v-2d5f533b><header class="navbar" data-v-2d5f533b><div class="sidebar-button"><svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" role="img" viewBox="0 0 448 512" class="icon"><path fill="currentColor" d="M436 124H12c-6.627 0-12-5.373-12-12V80c0-6.627 5.373-12 12-12h424c6.627 0 12 5.373 12 12v32c0 6.627-5.373 12-12 12zm0 160H12c-6.627 0-12-5.373-12-12v-32c0-6.627 5.373-12 12-12h424c6.627 0 12 5.373 12 12v32c0 6.627-5.373 12-12 12zm0 160H12c-6.627 0-12-5.373-12-12v-32c0-6.627 5.373-12 12-12h424c6.627 0 12 5.373 12 12v32c0 6.627-5.373 12-12 12z"></path></svg></div> <a href="/" class="home-link router-link-active"><!----> <span class="site-name">Life &amp; Hobby</span></a> <div class="links"><div class="color-picker"><a class="color-button"><i class="iconfont reco-color"></i></a> <div class="color-picker-menu" style="display:none;"><div class="mode-options"><h4 class="title">Choose mode</h4> <ul class="color-mode-options"><li class="dark">dark</li><li class="auto active">auto</li><li class="light">light</li></ul></div></div></div> <div class="search-box"><i class="iconfont reco-search"></i> <input aria-label="Search" autocomplete="off" spellcheck="false" value=""> <!----></div> <nav class="nav-links can-hide"><div class="nav-item"><a href="/tag/" class="nav-link"><i class="iconfont reco-tag"></i>
  Tag
</a></div><div class="nav-item"><div class="dropdown-wrapper"><a class="dropdown-title"><span class="title"><i class="iconfont reco-blog"></i>
      Category
    </span> <span class="arrow right"></span></a> <ul class="nav-dropdown" style="display:none;"><li class="dropdown-item"><!----> <a href="/Category/zhaiji/index.html" class="nav-link"><i class="iconfont undefined"></i>
  摘记
</a></li><li class="dropdown-item"><!----> <a href="/Category/suibi/index.html" class="nav-link"><i class="iconfont undefined"></i>
  随笔
</a></li></ul></div></div><div class="nav-item"><div class="dropdown-wrapper"><a class="dropdown-title"><span class="title"><i class="iconfont reco-blog"></i>
      前端基础
    </span> <span class="arrow right"></span></a> <ul class="nav-dropdown" style="display:none;"><li class="dropdown-item"><!----> <a href="/web/vscode/" class="nav-link"><i class="iconfont undefined"></i>
  开发环境
</a></li><li class="dropdown-item"><!----> <a href="/web/htmls/" class="nav-link"><i class="iconfont undefined"></i>
  html基础
</a></li><li class="dropdown-item"><!----> <a href="/web/css/" class="nav-link"><i class="iconfont undefined"></i>
  css基础
</a></li><li class="dropdown-item"><!----> <a href="/web/jsg/" class="nav-link"><i class="iconfont undefined"></i>
  javaScript
</a></li><li class="dropdown-item"><!----> <a href="/web/kuayu/" class="nav-link"><i class="iconfont undefined"></i>
  前端跨域
</a></li><li class="dropdown-item"><!----> <a href="/web/typeScript/typeScript.html" class="nav-link"><i class="iconfont undefined"></i>
  typeScript
</a></li></ul></div></div><div class="nav-item"><div class="dropdown-wrapper"><a class="dropdown-title"><span class="title"><i class="iconfont reco-other"></i>
      前端框架
    </span> <span class="arrow right"></span></a> <ul class="nav-dropdown" style="display:none;"><li class="dropdown-item"><!----> <a href="/frame/vue/vuecli.html" aria-current="page" class="nav-link router-link-exact-active router-link-active"><i class="iconfont undefined"></i>
  Vue
</a></li><li class="dropdown-item"><!----> <a href="/frame/react/" class="nav-link"><i class="iconfont undefined"></i>
  React
</a></li><li class="dropdown-item"><!----> <a href="/frame/Wechat/Wechat.html" class="nav-link"><i class="iconfont undefined"></i>
  Wechat
</a></li></ul></div></div><div class="nav-item"><div class="dropdown-wrapper"><a class="dropdown-title"><span class="title"><i class="iconfont reco-three"></i>
      工具集合
    </span> <span class="arrow right"></span></a> <ul class="nav-dropdown" style="display:none;"><li class="dropdown-item"><!----> <a href="/Server/node/node1.html" class="nav-link"><i class="iconfont undefined"></i>
  nodeJs
</a></li><li class="dropdown-item"><!----> <a href="/Server/php/phpjieshao.html" class="nav-link"><i class="iconfont undefined"></i>
  php
</a></li><li class="dropdown-item"><!----> <a href="/Server/git/git1.html" class="nav-link"><i class="iconfont undefined"></i>
  gitee
</a></li><li class="dropdown-item"><!----> <a href="/Server/cmd/" class="nav-link"><i class="iconfont undefined"></i>
  cmd
</a></li><li class="dropdown-item"><!----> <a href="/Server/LayaAir2/" class="nav-link"><i class="iconfont undefined"></i>
  LayaAir2
</a></li><li class="dropdown-item"><!----> <a href="/Server/three/" class="nav-link"><i class="iconfont undefined"></i>
  three
</a></li></ul></div></div><div class="nav-item"><div class="dropdown-wrapper"><a class="dropdown-title"><span class="title"><i class="iconfont reco-coding"></i>
      数据库
    </span> <span class="arrow right"></span></a> <ul class="nav-dropdown" style="display:none;"><li class="dropdown-item"><!----> <a href="/database/mysql/" class="nav-link"><i class="iconfont undefined"></i>
  mysql
</a></li><li class="dropdown-item"><!----> <a href="/database/mongodb/" class="nav-link"><i class="iconfont undefined"></i>
  mongo
</a></li></ul></div></div><div class="nav-item"><a href="https://gitee.com/yongqi666" target="_blank" rel="noopener noreferrer" class="nav-link external"><i class="iconfont reco-mayun"></i>
  gitee
  <svg xmlns="http://www.w3.org/2000/svg" aria-labelledby="outbound-link-title" role="img" focusable="false" x="0px" y="0px" viewBox="0 0 100 100" width="15" height="15" class="icon outbound"><title id="outbound-link-title">(opens new window)</title> <path fill="currentColor" d="M18.8,85.1h56l0,0c2.2,0,4-1.8,4-4v-32h-8v28h-48v-48h28v-8h-32l0,0c-2.2,0-4,1.8-4,4v56C14.8,83.3,16.6,85.1,18.8,85.1z"></path> <polygon fill="currentColor" points="45.7,48.7 51.3,54.3 77.2,28.5 77.2,37.2 85.2,37.2 85.2,14.9 62.8,14.9 62.8,22.9 71.5,22.9"></polygon></svg></a></div> <!----></nav></div></header> <div class="sidebar-mask" data-v-2d5f533b></div> <aside class="sidebar" data-v-2d5f533b><div class="personal-info-wrapper" data-v-ca798c94 data-v-2d5f533b><img src="/image.jpg" alt="author-avatar" class="personal-img" data-v-ca798c94> <h3 class="name" data-v-ca798c94>
    柚子
  </h3> <div class="num" data-v-ca798c94><div data-v-ca798c94><h3 data-v-ca798c94>30</h3> <h6 data-v-ca798c94>文章</h6></div> <div data-v-ca798c94><h3 data-v-ca798c94>15</h3> <h6 data-v-ca798c94>标签</h6></div></div> <hr data-v-ca798c94></div> <nav class="nav-links"><div class="nav-item"><a href="/tag/" class="nav-link"><i class="iconfont reco-tag"></i>
  Tag
</a></div><div class="nav-item"><div class="dropdown-wrapper"><a class="dropdown-title"><span class="title"><i class="iconfont reco-blog"></i>
      Category
    </span> <span class="arrow right"></span></a> <ul class="nav-dropdown" style="display:none;"><li class="dropdown-item"><!----> <a href="/Category/zhaiji/index.html" class="nav-link"><i class="iconfont undefined"></i>
  摘记
</a></li><li class="dropdown-item"><!----> <a href="/Category/suibi/index.html" class="nav-link"><i class="iconfont undefined"></i>
  随笔
</a></li></ul></div></div><div class="nav-item"><div class="dropdown-wrapper"><a class="dropdown-title"><span class="title"><i class="iconfont reco-blog"></i>
      前端基础
    </span> <span class="arrow right"></span></a> <ul class="nav-dropdown" style="display:none;"><li class="dropdown-item"><!----> <a href="/web/vscode/" class="nav-link"><i class="iconfont undefined"></i>
  开发环境
</a></li><li class="dropdown-item"><!----> <a href="/web/htmls/" class="nav-link"><i class="iconfont undefined"></i>
  html基础
</a></li><li class="dropdown-item"><!----> <a href="/web/css/" class="nav-link"><i class="iconfont undefined"></i>
  css基础
</a></li><li class="dropdown-item"><!----> <a href="/web/jsg/" class="nav-link"><i class="iconfont undefined"></i>
  javaScript
</a></li><li class="dropdown-item"><!----> <a href="/web/kuayu/" class="nav-link"><i class="iconfont undefined"></i>
  前端跨域
</a></li><li class="dropdown-item"><!----> <a href="/web/typeScript/typeScript.html" class="nav-link"><i class="iconfont undefined"></i>
  typeScript
</a></li></ul></div></div><div class="nav-item"><div class="dropdown-wrapper"><a class="dropdown-title"><span class="title"><i class="iconfont reco-other"></i>
      前端框架
    </span> <span class="arrow right"></span></a> <ul class="nav-dropdown" style="display:none;"><li class="dropdown-item"><!----> <a href="/frame/vue/vuecli.html" aria-current="page" class="nav-link router-link-exact-active router-link-active"><i class="iconfont undefined"></i>
  Vue
</a></li><li class="dropdown-item"><!----> <a href="/frame/react/" class="nav-link"><i class="iconfont undefined"></i>
  React
</a></li><li class="dropdown-item"><!----> <a href="/frame/Wechat/Wechat.html" class="nav-link"><i class="iconfont undefined"></i>
  Wechat
</a></li></ul></div></div><div class="nav-item"><div class="dropdown-wrapper"><a class="dropdown-title"><span class="title"><i class="iconfont reco-three"></i>
      工具集合
    </span> <span class="arrow right"></span></a> <ul class="nav-dropdown" style="display:none;"><li class="dropdown-item"><!----> <a href="/Server/node/node1.html" class="nav-link"><i class="iconfont undefined"></i>
  nodeJs
</a></li><li class="dropdown-item"><!----> <a href="/Server/php/phpjieshao.html" class="nav-link"><i class="iconfont undefined"></i>
  php
</a></li><li class="dropdown-item"><!----> <a href="/Server/git/git1.html" class="nav-link"><i class="iconfont undefined"></i>
  gitee
</a></li><li class="dropdown-item"><!----> <a href="/Server/cmd/" class="nav-link"><i class="iconfont undefined"></i>
  cmd
</a></li><li class="dropdown-item"><!----> <a href="/Server/LayaAir2/" class="nav-link"><i class="iconfont undefined"></i>
  LayaAir2
</a></li><li class="dropdown-item"><!----> <a href="/Server/three/" class="nav-link"><i class="iconfont undefined"></i>
  three
</a></li></ul></div></div><div class="nav-item"><div class="dropdown-wrapper"><a class="dropdown-title"><span class="title"><i class="iconfont reco-coding"></i>
      数据库
    </span> <span class="arrow right"></span></a> <ul class="nav-dropdown" style="display:none;"><li class="dropdown-item"><!----> <a href="/database/mysql/" class="nav-link"><i class="iconfont undefined"></i>
  mysql
</a></li><li class="dropdown-item"><!----> <a href="/database/mongodb/" class="nav-link"><i class="iconfont undefined"></i>
  mongo
</a></li></ul></div></div><div class="nav-item"><a href="https://gitee.com/yongqi666" target="_blank" rel="noopener noreferrer" class="nav-link external"><i class="iconfont reco-mayun"></i>
  gitee
  <svg xmlns="http://www.w3.org/2000/svg" aria-labelledby="outbound-link-title" role="img" focusable="false" x="0px" y="0px" viewBox="0 0 100 100" width="15" height="15" class="icon outbound"><title id="outbound-link-title">(opens new window)</title> <path fill="currentColor" d="M18.8,85.1h56l0,0c2.2,0,4-1.8,4-4v-32h-8v28h-48v-48h28v-8h-32l0,0c-2.2,0-4,1.8-4,4v56C14.8,83.3,16.6,85.1,18.8,85.1z"></path> <polygon fill="currentColor" points="45.7,48.7 51.3,54.3 77.2,28.5 77.2,37.2 85.2,37.2 85.2,14.9 62.8,14.9 62.8,22.9 71.5,22.9"></polygon></svg></a></div> <!----></nav> <ul class="sidebar-links"><li><section class="sidebar-group collapsable depth-0"><p class="sidebar-heading open"><span>Vue</span> <span class="arrow down"></span></p> <ul class="sidebar-links sidebar-group-items"><li><a href="/frame/vue/vuecli.html" aria-current="page" class="active sidebar-link">Vue安装</a></li><li><a href="/frame/vue/Vue2.html" class="sidebar-link">Vue&amp;vue 以及基本语法</a></li><li><a href="/frame/vue/Vue3.html" class="sidebar-link">Vue 指令</a></li><li><a href="/frame/vue/Vue4.html" class="sidebar-link">Vue 组件通信</a></li><li><a href="/frame/vue/Vue5.html" class="sidebar-link">Vue 路由模式</a></li><li><a href="/frame/vue/Vue6.html" class="sidebar-link">Vue3.0初相识</a></li><li><a href="/frame/vue/Vue7.html" class="sidebar-link">Vue3.0 Store</a></li></ul></section></li></ul> </aside> <div class="password-shadow password-wrapper-in" style="display:none;" data-v-64685f0e data-v-2d5f533b><h3 class="title" style="display:none;" data-v-64685f0e data-v-64685f0e>Vue安装</h3> <!----> <label id="box" class="inputBox" style="display:none;" data-v-64685f0e data-v-64685f0e><input type="password" value="" data-v-64685f0e> <span data-v-64685f0e>Konck! Knock!</span> <button data-v-64685f0e>OK</button></label> <div class="footer" style="display:none;" data-v-64685f0e data-v-64685f0e><span data-v-64685f0e><i class="iconfont reco-theme" data-v-64685f0e></i> <a target="blank" href="https://vuepress-theme-reco.recoluan.com" data-v-64685f0e>vuePress-theme-reco</a></span> <span data-v-64685f0e><i class="iconfont reco-copyright" data-v-64685f0e></i> <a data-v-64685f0e><span data-v-64685f0e>柚子</span>
            
          <span data-v-64685f0e>2018 - </span>
          2021
        </a></span></div></div> <div data-v-2d5f533b><main class="page"><div class="page-title" style="display:none;"><h1 class="title">Vue安装</h1> <div data-v-3b7f5bdf><i class="iconfont reco-account" data-v-3b7f5bdf><span data-v-3b7f5bdf>柚子</span></i> <i class="iconfont reco-date" data-v-3b7f5bdf><span data-v-3b7f5bdf>2021-01-24</span></i> <!----> <i class="iconfont reco-tag tags" data-v-3b7f5bdf><span class="tag-item" data-v-3b7f5bdf>Vue</span></i></div></div> <div class="theme-reco-content content__default" style="display:none;"><p><strong>Vue 介绍</strong></p> <blockquote><p>Vue 是前端开发框架，构建应用式的框架，能实现单页面应用的渐进式框架</p></blockquote> <p><strong>Vue 的优点？</strong></p> <ol><li>遵循 <code>MVVM</code> 格式</li> <li>体积小,运行效率高</li> <li>关注数据的变化，不操作 <code>DOM</code></li> <li>组件化开发，利于开发和维护</li> <li>能实现<code>单页面应用</code>，SPA 应用（single page application）</li></ol> <p><strong>Vue 的使用方式？</strong></p> <ul><li><strong>使用 ui 界面创建</strong> ：<code>vue ui</code></li> <li><strong>使用命令行创建</strong> ： <code>vue create vueapp</code></li></ul> <ol><li>选择配置方式</li></ol> <div class="language-js extra-class"><pre class="language-js"><code><span class="token keyword">default</span> <span class="token punctuation">(</span>babel<span class="token punctuation">,</span> eslint<span class="token punctuation">)</span> 默认
❯ Manually select features 手动
</code></pre></div><ol start="2"><li>选择需要的配置，通过空格来切换选中状态</li></ol> <div class="language-js extra-class"><pre class="language-js"><code> Check the features needed <span class="token keyword">for</span> your pro
 ject<span class="token operator">:</span>
 ◉ Babel
 ◯ TypeScript
 ◯ Progressive Web <span class="token function">App</span> <span class="token punctuation">(</span><span class="token constant">PWA</span><span class="token punctuation">)</span> Support
 ◉ Router
 ❯◉ Vuex
 ◯ <span class="token constant">CSS</span> Pre<span class="token operator">-</span>processors
 ◉ Linter <span class="token operator">/</span> Formatter
 ◯ Unit Testing
 ◯ <span class="token constant">E2E</span> Testing
</code></pre></div><ol start="3"><li>选择路由的模式</li></ol> <div class="language-js extra-class"><pre class="language-js"><code> Use history mode <span class="token keyword">for</span> router<span class="token operator">?</span>
 <span class="token punctuation">(</span>Requires proper server setup <span class="token keyword">for</span> index fallbackin production<span class="token punctuation">)</span> <span class="token punctuation">(</span><span class="token constant">Y</span><span class="token operator">/</span>n<span class="token punctuation">)</span>
</code></pre></div><ol start="3"><li>选择 css 预处理器</li></ol> <div class="language-js extra-class"><pre class="language-js"><code>   Pick a <span class="token constant">CSS</span> pre<span class="token operator">-</span><span class="token function">processor</span> <span class="token punctuation">(</span>PostCSS<span class="token punctuation">,</span> Autoprefixer and <span class="token constant">CSS</span> Modules are supported
   by <span class="token keyword">default</span><span class="token punctuation">)</span><span class="token operator">:</span>
   ❯ Sass<span class="token operator">/</span><span class="token constant">SCSS</span> <span class="token punctuation">(</span><span class="token keyword">with</span> dart<span class="token operator">-</span>sass<span class="token punctuation">)</span>
   Sass<span class="token operator">/</span><span class="token constant">SCSS</span> <span class="token punctuation">(</span><span class="token keyword">with</span> node<span class="token operator">-</span>sass<span class="token punctuation">)</span>
   Less
   Stylus
</code></pre></div><ol start="4"><li>选中一种 eslint 配置</li></ol> <div class="language-js extra-class"><pre class="language-js"><code> Pick a linter <span class="token operator">/</span> formatter config<span class="token operator">:</span> <span class="token punctuation">(</span>Use
   arrow keys<span class="token punctuation">)</span>
   ESLint <span class="token keyword">with</span> error prevention only
   ❯ ESLint <span class="token operator">+</span> Airbnb config
   ESLint <span class="token operator">+</span> Standard config
   ESLint <span class="token operator">+</span> Prettier
</code></pre></div><ol start="5"><li>eslint 的使用规则</li></ol> <div class="language-js extra-class"><pre class="language-js"><code>  Pick additional lint features<span class="token operator">:</span>
   ◉ Lint on save 保存的时候进行 eslint 检测
   ❯◉ Lint and fix on commit 提交的时候检测并且修复   arrow keys<span class="token punctuation">)</span>
   ESLint <span class="token keyword">with</span> error prevention only
   ❯ ESLint <span class="token operator">+</span> Airbnb config
   ESLint <span class="token operator">+</span> Standard config
   ESLint <span class="token operator">+</span> Prettier
</code></pre></div><ol start="6"><li>使用哪种配置文件</li></ol> <div class="language-js extra-class"><pre class="language-js"><code>   Where <span class="token keyword">do</span> you prefer placing config <span class="token keyword">for</span>
   Babel<span class="token punctuation">,</span> PostCSS<span class="token punctuation">,</span> ESLint<span class="token punctuation">,</span> etc<span class="token punctuation">.</span><span class="token operator">?</span> <span class="token punctuation">(</span>Use arro
   w keys<span class="token punctuation">)</span>
   ❯ In dedicated config files
   In <span class="token keyword">package</span><span class="token punctuation">.</span>json
</code></pre></div><ol start="7"><li>是否保存以上配置做为预设</li></ol> <div class="language-js extra-class"><pre class="language-js"><code> Save <span class="token keyword">this</span> <span class="token keyword">as</span> a preset <span class="token keyword">for</span> future proje
 cts<span class="token operator">?</span>
</code></pre></div><ol start="8"><li>预设的作用就是可以直接使用之前的配置不用 假设之前的预设叫做 1709</li></ol> <div class="language-js extra-class"><pre class="language-js"><code>Please pick a preset<span class="token operator">:</span> <span class="token punctuation">(</span>Use arrow keys<span class="token punctuation">)</span>

❯ <span class="token number">1709</span> <span class="token punctuation">(</span>vue<span class="token operator">-</span>router<span class="token punctuation">,</span> vuex<span class="token punctuation">,</span> less<span class="token punctuation">,</span> babel<span class="token punctuation">,</span> e
slint<span class="token punctuation">)</span>
  <span class="token function">vuepre1</span> <span class="token punctuation">(</span>vue<span class="token operator">-</span>router<span class="token punctuation">,</span> less<span class="token punctuation">,</span> babel<span class="token punctuation">)</span>
  <span class="token function">iviewpreset</span> <span class="token punctuation">(</span>vue<span class="token operator">-</span>router<span class="token punctuation">,</span> vuex<span class="token punctuation">,</span> less<span class="token punctuation">,</span> b
abel<span class="token punctuation">,</span> eslint<span class="token punctuation">)</span>
 <span class="token keyword">default</span> <span class="token punctuation">(</span>babel<span class="token punctuation">,</span> eslint<span class="token punctuation">)</span> 默认
 Manually select features 手动
</code></pre></div><ol start="9"><li>启动项目</li></ol> <div class="language-cmd extra-class"><pre class="language-text"><code>npm run dev
</code></pre></div><ol start="10"><li>更改 vue 启动端口
<blockquote><p>创建一个 vue.config.js 文件</p></blockquote></li></ol> <div class="language-js extra-class"><pre class="language-js"><code>module<span class="token punctuation">.</span>exports <span class="token operator">=</span> <span class="token punctuation">{</span>
  devServer<span class="token operator">:</span> <span class="token punctuation">{</span>
    port<span class="token operator">:</span> <span class="token number">80</span><span class="token punctuation">,</span> <span class="token comment">// 端口</span>
  <span class="token punctuation">}</span><span class="token punctuation">,</span>
<span class="token punctuation">}</span><span class="token punctuation">;</span>
</code></pre></div><h2 id="创建一个-vue3-0-ts-项目"><a href="#创建一个-vue3-0-ts-项目" class="header-anchor">#</a> 创建一个 vue3.0 + ts 项目</h2> <h3 id="开始创建"><a href="#开始创建" class="header-anchor">#</a> 开始创建</h3> <div class="language-cmd extra-class"><pre class="language-text"><code>vue create vueapp
</code></pre></div><h3 id="手动选择配置"><a href="#手动选择配置" class="header-anchor">#</a> 手动选择配置</h3> <p><span style="color:red;">你会被提示选取一个 preset。你可以选默认的包含了基本的 Babel + ESLint 设置的 preset，也可以选“手动选择特性”来选取需要的特性。默认是没有 ts，所以我们要选择第二个来自定义我们所需要的；</span></p> <div class="language-js extra-class"><pre class="language-js"><code><span class="token operator">?</span> Please pick a preset<span class="token operator">:</span>

<span class="token keyword">default</span> <span class="token punctuation">(</span>babel<span class="token punctuation">,</span> eslint<span class="token punctuation">)</span> <span class="token comment">//默认配置</span>

<span class="token operator">&gt;</span> Manually select features <span class="token comment">//手动选择</span>
</code></pre></div><h3 id="选择功能"><a href="#选择功能" class="header-anchor">#</a> 选择功能</h3> <p><span style="color:red;">接下来就是选择我们所需的选项来生成项目，使用 空格键 选中</span></p> <div class="language-js extra-class"><pre class="language-js"><code>
<span class="token operator">?</span> Check the features needed <span class="token keyword">for</span> your project<span class="token operator">:</span>

<span class="token punctuation">(</span><span class="token operator">*</span><span class="token punctuation">)</span> Babel <span class="token comment">// javascript转译器</span>

<span class="token punctuation">(</span><span class="token operator">*</span><span class="token punctuation">)</span> TypeScript <span class="token comment">// 使用 TypeScript 书写源码</span>

<span class="token punctuation">(</span> <span class="token punctuation">)</span> Progressive Web <span class="token function">App</span> <span class="token punctuation">(</span><span class="token constant">PWA</span><span class="token punctuation">)</span> Support <span class="token comment">// 渐进式WEB应用</span>

<span class="token punctuation">(</span><span class="token operator">*</span><span class="token punctuation">)</span> Router <span class="token comment">// 使用vue-router</span>

<span class="token punctuation">(</span><span class="token operator">*</span><span class="token punctuation">)</span> Vuex <span class="token comment">// 使用vuex</span>

<span class="token punctuation">(</span><span class="token operator">*</span><span class="token punctuation">)</span> <span class="token constant">CSS</span> Pre<span class="token operator">-</span>processors <span class="token comment">// 使用css预处理器</span>

<span class="token operator">&gt;</span><span class="token punctuation">(</span><span class="token operator">*</span><span class="token punctuation">)</span> Linter <span class="token operator">/</span> Formatter <span class="token comment">// 代码规范标准</span>

<span class="token punctuation">(</span> <span class="token punctuation">)</span> Unit Testing <span class="token comment">// 单元测试</span>

<span class="token punctuation">(</span> <span class="token punctuation">)</span> <span class="token constant">E2E</span> Testing <span class="token comment">// e2e测试</span>

</code></pre></div><h3 id="是否使用-class-风格装饰器"><a href="#是否使用-class-风格装饰器" class="header-anchor">#</a> 是否使用 Class 风格装饰器？</h3> <p><span style="color:red;">即原本是：home = new Vue()创建 vue 实例
使用装饰器后：class home extends Vue{}</span></p> <div class="language-js extra-class"><pre class="language-js"><code><span class="token operator">?</span> Use <span class="token keyword">class</span><span class="token operator">-</span>style component syntax<span class="token operator">?</span> <span class="token punctuation">(</span><span class="token constant">Y</span><span class="token operator">/</span>n<span class="token punctuation">)</span> <span class="token constant">N</span>
</code></pre></div><h3 id="使用-babel-与-typescript-一起用于自动检测的填充"><a href="#使用-babel-与-typescript-一起用于自动检测的填充" class="header-anchor">#</a> 使用 Babel 与 TypeScript 一起用于自动检测的填充</h3> <div class="language-js extra-class"><pre class="language-js"><code><span class="token operator">?</span> Use Babel alongside <span class="token function">TypeScript</span> <span class="token punctuation">(</span>required <span class="token keyword">for</span> modern mode<span class="token punctuation">,</span> auto<span class="token operator">-</span>detected polyfills<span class="token punctuation">,</span> transpiling <span class="token constant">JSX</span><span class="token punctuation">)</span><span class="token operator">?</span> <span class="token punctuation">(</span><span class="token constant">Y</span><span class="token operator">/</span>n<span class="token punctuation">)</span> <span class="token constant">Y</span>
</code></pre></div><h3 id="路由模式"><a href="#路由模式" class="header-anchor">#</a> 路由模式</h3> <div class="language-js extra-class"><pre class="language-js"><code><span class="token operator">?</span> Use history mode <span class="token keyword">for</span> router<span class="token operator">?</span> <span class="token punctuation">(</span>Requires proper server setup <span class="token keyword">for</span> index fallback <span class="token keyword">in</span> production<span class="token punctuation">)</span> <span class="token punctuation">(</span><span class="token constant">Y</span><span class="token operator">/</span>n<span class="token punctuation">)</span> <span class="token constant">Y</span>
</code></pre></div><h3 id="我选择-sass-scss-with-dart-sass"><a href="#我选择-sass-scss-with-dart-sass" class="header-anchor">#</a> 我选择 Sass/SCSS (with dart-sass)</h3> <div class="language-js extra-class"><pre class="language-js"><code><span class="token operator">?</span> Pick a <span class="token constant">CSS</span> pre<span class="token operator">-</span><span class="token function">processor</span> <span class="token punctuation">(</span>PostCSS<span class="token punctuation">,</span> Autoprefixer and <span class="token constant">CSS</span> Modules are supportedby <span class="token keyword">default</span><span class="token punctuation">)</span><span class="token operator">:</span> <span class="token punctuation">(</span>Use arrow keys<span class="token punctuation">)</span>

<span class="token operator">&gt;</span> Sass<span class="token operator">/</span><span class="token constant">SCSS</span> <span class="token punctuation">(</span><span class="token keyword">with</span> dart<span class="token operator">-</span>sass<span class="token punctuation">)</span> <span class="token comment">// 保存后编译</span>

Sass<span class="token operator">/</span><span class="token constant">SCSS</span> <span class="token punctuation">(</span><span class="token keyword">with</span> node<span class="token operator">-</span>sass<span class="token punctuation">)</span> <span class="token comment">// 实时编译</span>

Less

Stylus
</code></pre></div><h3 id="选择-代码格式化检测-因为是用-typescript-所以选择-tslint"><a href="#选择-代码格式化检测-因为是用-typescript-所以选择-tslint" class="header-anchor">#</a> 选择 代码格式化检测 因为是用 typescript 所以选择 TSLint</h3> <div class="language-js extra-class"><pre class="language-js"><code><span class="token operator">?</span> Pick a linter <span class="token operator">/</span> formatter config<span class="token operator">:</span> <span class="token punctuation">(</span>Use arrow keys<span class="token punctuation">)</span>

<span class="token operator">&gt;</span> TSLint <span class="token comment">// typescript格式验证工具</span>

ESLint <span class="token keyword">with</span> error prevention only <span class="token comment">// 只进行报错提醒</span>

ESLint <span class="token operator">+</span> Airbnb config <span class="token comment">// 不严谨模式</span>

ESLint <span class="token operator">+</span> Standard config <span class="token comment">// 正常模式</span>

ESLint <span class="token operator">+</span> Prettier <span class="token comment">// 严格模式</span>
</code></pre></div><h3 id="代码检查方式-保存检查"><a href="#代码检查方式-保存检查" class="header-anchor">#</a> 代码检查方式 保存检查</h3> <div class="language-js extra-class"><pre class="language-js"><code><span class="token operator">&gt;</span> to invert selection<span class="token punctuation">)</span>

<span class="token operator">&gt;</span><span class="token punctuation">(</span><span class="token operator">*</span><span class="token punctuation">)</span> Lint on <span class="token function">save</span>

<span class="token punctuation">(</span> <span class="token punctuation">)</span> Lint and fix on commit
</code></pre></div><h3 id="文件配置-我选择配置在独立的文件中"><a href="#文件配置-我选择配置在独立的文件中" class="header-anchor">#</a> 文件配置，我选择配置在独立的文件中</h3> <div class="language-js extra-class"><pre class="language-js"><code><span class="token operator">?</span> Where <span class="token keyword">do</span> you prefer placing config <span class="token keyword">for</span> Babel<span class="token punctuation">,</span> PostCSS<span class="token punctuation">,</span> ESLint<span class="token punctuation">,</span> etc<span class="token punctuation">.</span><span class="token operator">?</span> <span class="token punctuation">(</span>Use arrow keys<span class="token punctuation">)</span>

<span class="token operator">&gt;</span> In dedicated config files

In <span class="token keyword">package</span><span class="token punctuation">.</span>json
</code></pre></div><h3 id="保存上述配置-保存后下一次可直接根据上述配置生成项目-这里我就不保存了-有需要的同学可自行保存"><a href="#保存上述配置-保存后下一次可直接根据上述配置生成项目-这里我就不保存了-有需要的同学可自行保存" class="header-anchor">#</a> 保存上述配置，保存后下一次可直接根据上述配置生成项目，这里我就不保存了，有需要的同学可自行保存</h3> <div class="language-js extra-class"><pre class="language-js"><code>ted config files <span class="token operator">?</span> Save <span class="token keyword">this</span> <span class="token keyword">as</span> a preset <span class="token keyword">for</span> future projects<span class="token operator">?</span> <span class="token punctuation">(</span>y<span class="token operator">/</span><span class="token constant">N</span><span class="token punctuation">)</span> <span class="token constant">N</span>
</code></pre></div><h3 id="ok-等待项目加载各种包"><a href="#ok-等待项目加载各种包" class="header-anchor">#</a> OK，等待项目加载各种包...</h3> <div class="language-js extra-class"><pre class="language-js"><code>$ cd vue<span class="token operator">-</span>ts

$ npm run serve
</code></pre></div></div> <footer class="page-edit" style="display:none;"><!----> <!----></footer> <!----> <!----> <!----></main> <!----></div></div></div></div><div class="global-ui"><div class="back-to-ceiling" style="right:1rem;bottom:6rem;width:2.5rem;height:2.5rem;border-radius:.25rem;line-height:2.5rem;display:none;" data-v-c6073ba8 data-v-c6073ba8><svg t="1574745035067" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="5404" class="icon" data-v-c6073ba8><path d="M526.60727968 10.90185116a27.675 27.675 0 0 0-29.21455937 0c-131.36607665 82.28402758-218.69155461 228.01873535-218.69155402 394.07834331a462.20625001 462.20625001 0 0 0 5.36959153 69.94390903c1.00431239 6.55289093-0.34802892 13.13561351-3.76865779 18.80351572-32.63518765 54.11355614-51.75690182 118.55860487-51.7569018 187.94566865a371.06718723 371.06718723 0 0 0 11.50484808 91.98906777c6.53300375 25.50556257 41.68394495 28.14064038 52.69160883 4.22606766 17.37162448-37.73630017 42.14135425-72.50938081 72.80769204-103.21549295 2.18761121 3.04276886 4.15646224 6.24463696 6.40373557 9.22774369a1871.4375 1871.4375 0 0 0 140.04691725 5.34970492 1866.36093723 1866.36093723 0 0 0 140.04691723-5.34970492c2.24727335-2.98310674 4.21612437-6.18497483 6.3937923-9.2178004 30.66633723 30.70611158 55.4360664 65.4791928 72.80769147 103.21549355 11.00766384 23.91457269 46.15860503 21.27949489 52.69160879-4.22606768a371.15156223 371.15156223 0 0 0 11.514792-91.99901164c0-69.36717486-19.13165746-133.82216804-51.75690182-187.92578088-3.42062944-5.66790279-4.76302748-12.26056868-3.76865837-18.80351632a462.20625001 462.20625001 0 0 0 5.36959269-69.943909c-0.00994388-166.08943902-87.32547796-311.81420293-218.6915546-394.09823051zM605.93803103 357.87693858a93.93749974 93.93749974 0 1 1-187.89594924 6.1e-7 93.93749974 93.93749974 0 0 1 187.89594924-6.1e-7z" p-id="5405" data-v-c6073ba8></path><path d="M429.50777625 765.63860547C429.50777625 803.39355007 466.44236686 1000.39046097 512.00932183 1000.39046097c45.56695499 0 82.4922232-197.00623328 82.5015456-234.7518555 0-37.75494459-36.9345906-68.35043303-82.4922232-68.34111062-45.57627738-0.00932239-82.52019037 30.59548842-82.51086798 68.34111062z" p-id="5406" data-v-c6073ba8></path></svg></div><div class="reco-bgm-panel" data-v-39f9e6e0><audio id="bgm" src="/yishengduyi.mp3" data-v-39f9e6e0></audio> <div class="reco-float-box" style="bottom:200px;z-index:999999;display:none;" data-v-39f9e6e0 data-v-41bcba48 data-v-39f9e6e0><img src="/yishengduyi.jpg" data-v-39f9e6e0></div> <div class="reco-bgm-box" style="left:10px;bottom:10px;z-index:999999;" data-v-39f9e6e0 data-v-41bcba48 data-v-39f9e6e0><div class="reco-bgm-cover" style="background-image:url(/yishengduyi.jpg);" data-v-39f9e6e0><div class="mini-operation" style="display:none;" data-v-39f9e6e0><i class="reco-bgm reco-bgm-pause" style="display:none;" data-v-39f9e6e0></i> <i class="reco-bgm reco-bgm-play" style="display:none;" data-v-39f9e6e0></i></div> <div class="falut-message" style="display:none;" data-v-39f9e6e0>
          播放失败
        </div></div> <div class="reco-bgm-info" data-v-39f9e6e0 data-v-41bcba48 data-v-39f9e6e0><div class="info-box" data-v-39f9e6e0><i class="reco-bgm reco-bgm-music music" data-v-39f9e6e0></i>一生独一</div> <div class="info-box" data-v-39f9e6e0><i class="reco-bgm reco-bgm-artist" data-v-39f9e6e0></i>卢焱</div> <div class="reco-bgm-progress" data-v-39f9e6e0><div class="progress-bar" data-v-39f9e6e0><div class="bar" data-v-39f9e6e0></div></div></div> <div class="reco-bgm-operation" data-v-39f9e6e0><i class="reco-bgm reco-bgm-last last" data-v-39f9e6e0></i> <i class="reco-bgm reco-bgm-pause pause" style="display:none;" data-v-39f9e6e0></i> <i class="reco-bgm reco-bgm-play play" data-v-39f9e6e0></i> <i class="reco-bgm reco-bgm-next next" data-v-39f9e6e0></i> <i class="reco-bgm reco-bgm-volume1 volume" data-v-39f9e6e0></i> <i class="reco-bgm reco-bgm-mute mute" style="display:none;" data-v-39f9e6e0></i> <div class="volume-bar" data-v-39f9e6e0><div class="bar" data-v-39f9e6e0></div></div></div></div> <div class="reco-bgm-left-box" data-v-39f9e6e0 data-v-41bcba48 data-v-39f9e6e0><i class="reco-bgm reco-bgm-left" data-v-39f9e6e0></i></div></div></div><canvas id="vuepress-canvas-cursor"></canvas><div></div></div></div>
    <script src="/assets/js/app.443cfbf6.js" defer></script><script src="/assets/js/3.1a8b1c56.js" defer></script><script src="/assets/js/1.35aae7fc.js" defer></script><script src="/assets/js/54.8547cd19.js" defer></script>
  </body>
</html>
